package webDriver;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;

import java.io.File;

/**
 * Created with IntelliJ IDEA.
 * User: C13T
 * Date: 10.07.13
 * Time: 19:22
 * To change this template use File | Settings | File Templates.
 */
public class WebDriverFactory {
    private static WebDriver driver;

    public static WebDriver createDriver(String browserName){
        if (browserName.equals("firefox")){
            driver= new FirefoxDriver();
        } else if (browserName.equals("chrome")){
            File file = new File("D:\\GoogleCode\\kozlov\\drivers\\chromedriver.exe");
            System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
            driver = new ChromeDriver();
        }   else if (browserName.equals("ie")){
            File file = new File("D:\\GoogleCode\\kozlov\\drivers\\IEDriverServer.exe");
            System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
            driver = new InternetExplorerDriver();
        }
        return driver;
    }
}
